import com.atguigu.realtime.bean.KeywordBean;

import java.lang.reflect.Field;

/**
 * @Author lzc
 * @Date 2022/5/27 11:30
 */
public class ClassDemo {
    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException, InstantiationException {
        Class<KeywordBean> tClass = KeywordBean.class;
    
        KeywordBean t = tClass.newInstance(); // 无参构造器
    
        Field stt = tClass.getDeclaredField("stt");
        stt.setAccessible(true);
        
        stt.set(t, "abc") ;  // t.stt="abc"
    
        System.out.println(t);
    
        System.out.println(stt.get(t));
        
    
        
      /*  for (Field field : fields) {
            System.out.println(field.getName());
        }
    
        System.out.println(Stream.of(fields)
                               .map(Field::getName)
                               .collect(Collectors.joining(",")));*/
    
    
    }
}
